package com.hit.aircraftwar.bullet;

import com.hit.aircraftwar.basic.AbstractFlyingObject;
import com.hit.aircraftwar.setter.TimeController;

public class MissileBoom extends AbstractBullet {

    private TimeController vanishCounting = null;
    private Thread vanishThread = null;

    public MissileBoom(int locationX, int locationY, int speedX, int speedY, int power) {
        super(locationX, locationY, speedX, speedY, power);
    }

    @Override
    public void vanish(){
        if(vanishCounting == null) {
            vanishCounting = new TimeController(240, 0, 0);
            vanishThread = new Thread(vanishCounting);
            vanishThread.start();
        }
        this.isValid = (vanishThread == null || vanishThread.isAlive());
    }

    @Override
    public boolean crash(AbstractFlyingObject abstractFlyingObject) {
        return false;
    }

    @Override
    public void bombed() {
    }
}
